import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);

const state = () => ({
  currentPath:'',
});

const mutations = {
  setPath(state,option){
    console.log('setPath',option)
    state.currentPath = option
  },

};

// 存在异步操作使用action，直接调用mutation中的函数
const actions = {
    setPath(context,option) {
        context.commit('setPath',option)
    }
}

export default {
  state,
  mutations,
  actions,
};
